package cn.edu.scau.cmi.xianjiehua.spring;

import java.net.URL;
import java.util.Iterator;
import java.util.List;
import java.util.ResourceBundle;
import java.util.Set;

import org.springframework.context.ApplicationContext;

import cn.edu.scau.cmi.xianjiehua.spring.domain.Student;
import cn.edu.scau.cmi.xianjiehua.spring.domain.Teacher;
import cn.edu.scau.cmi.xianjiehua.spring.util.ApplicationContextUtil;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

public class ViewController implements Initializable{
	
	@FXML
	private TextArea console;
	
	@FXML
	private Button teacherButton;
	
	@FXML
	private Button studentButton;
	
	ApplicationContext applicationContext;
	
	@Override
	public void initialize(URL location, ResourceBundle resources) {
		// TODO Auto-generated method stub
		applicationContext = ApplicationContextUtil.getApplicationContext();
	}
	

	public void studentEven(ActionEvent event) {
		Student student = (Student)applicationContext.getBean("xianjiehua");
		console.appendText(student.toString()+"\n");
	}
	

	public void teacherEven(ActionEvent event) {
		Teacher teacher = (Teacher)applicationContext.getBean("liangzaoqing");
		console.appendText(teacher.toString()+"\n");
	}

}
